#ifndef FILE_H
#define FILE_H

#include "typedefine.h"
#include<stdio.h>

class CFile
{
    #define FILE_NAME_LENTH_MAX     100
public:
      enum FileOpenFlag
        {
            OPEN_TEXT_READ_ONLY,
            OPEN_TEXT_WRITE_ONLY,
            OPEN_TEXT_READ_AND_WRITE,
            OPEN_BIN_READ_ONLY,
            OPEN_BIN_WRITE_ONLY,
            OPEN_BIN_READ_AND_WRITE    
        };
        
        FILE     *       pFile;
	s8 		        m_FileName[FILE_NAME_LENTH_MAX];
	
	
	bool			m_FileWritable;
	
public:
	CFile(const s8 * lpszPathName);
	~CFile(void);
	bool 		Close(void);
	bool 		Open(FileOpenFlag flag );

	bool 		GetLenth(u32 & lenth);
	bool 		GetByte(u32 OffSet, u8 & data);
	bool 		PutByte(u32 OffSet, u8 data);
        bool            SeekTo( u32 OffSet);

	bool 		Read( u8 * pBuff, u32 lenth, s32 OffSet = -1);
	bool 		Write( u8 * pBuff, u32 lenth, s32 OffSet = -1);

};


#endif
